package com.chenshu.bean;

import com.chenshu.model.User;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

/**
 * Created with IntelliJ IDEA
 * Description
 * User：chenshu
 * Date：2024-03-31
 * Time：20:56
 */
@Component
public class UserBean {

    @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
    @Bean(name = "user")
    public User getUserBean() {
        User user = new User();
        user.setName("zhangsan");
        user.setAge(20);
        return user;
    }
}
